import request from '@/utils/request'

// 登录方法
export function login(username, password, code, uuid) {
	const data = {
		username,
		password,
		code,
		uuid
	}
	return request({
		'url': '/login',
		headers: {
			isToken: false
		},
		'method': 'post',
		'data': data
	})
}


export function welogin(code) {

	const data = {
		code
	}
	return request({
		'url': '/robot/wechat/login',
		headers: {
			isToken: false
		},
		'method': 'get',
		params: data
	})
}

export function userRoomList(openid) {

	const data = {
		openid
	}
	return request({
		'url': '/robot/roomconfig/userRoomList',
		headers: {
			isToken: false
		},
		'method': 'get',
		params: data
	})
}


export function getRoomConfig(roomId) {

	const data = {
		roomId
	}
	return request({
		'url': '/robot/roomconfig/roomId',
		headers: {
			isToken: false
		},
		'method': 'get',
		params: data
	})
}


export function getRoomRoundConfig(roomId) {

	const data = {
		roomId
	}
	return request({
		'url': '/robot/roundconfig/roomId',
		headers: {
			isToken: false
		},
		'method': 'get',
		params: data
	})
}



export function getRoomTakeLeaveConfig(roomId) {

	const data = {
		roomId
	}
	return request({
		'url': '/robot/roomconfig/takeLeaveroomId',
		headers: {
			isToken: false
		},
		'method': 'get',
		params: data
	})
}

export function getRoomEventConfig(roomId) {

	const data = {
		roomId
	}
	return request({
		'url': '/robot/roomconfig/eventConfigroomId',
		headers: {
			isToken: false
		},
		'method': 'get',
		params: data
	})
}

export function getRoomBlockRecord(roomId) {
	const data = {
		roomId
	}
	return request({
		'url': '/robot/roomconfig/balockedRecordroomId',
		headers: {
			isToken: false
		},
		'method': 'get',
		params: data
	})
}

export function getRoomTopTask(roomId) {
	const data = {
		roomId
	}
	return request({
		'url': '/robot/roomconfig/toptaskroomId',
		headers: {
			isToken: false
		},
		'method': 'get',
		params: data
	})
}

export function getRoomZcInfo(roomId) {
	const data = {
		roomId
	}
	return request({
		'url': '/robot/roomconfig/getZcInfoByRoomId',
		headers: {
			isToken: false
		},
		'method': 'get',
		params: data
	})
}

export function getRoomStaticsMicro(data) {

	return request({
		'url': '/robot/statics/Micro',
		headers: {
			isToken: false
		},
		'method': 'get',
		params: data
	})
}


export function getRoomStaticsSlcakOff(data) {

	return request({
		'url': '/robot/statics/SlackOff',
		headers: {
			isToken: false
		},
		'method': 'get',
		params: data
	})
}

export function getRoomStaticsMemberInfo(data) {

	return request({
		'url': '/robot/statics/MemberInfo',
		headers: {
			isToken: false
		},
		'method': 'get',
		params: data
	})
}

/**
 * 更新新人置顶卡

 * @param {Object} data
 */
export function updateTopTask(data) {

	return request({
		'url': '/robot/roomconfig/toptaskupdate',
		headers: {
			isToken: false
		},
		method: 'put',
		data: data
	})
}

export function updateRoomConfig(data) {

	return request({
		'url': '/robot/roomconfig/updateRoomConfig',
		headers: {
			isToken: false
		},
		method: 'put',
		data: data
	})
}

/**
 * 更新报备

 * @param {Object} data
 */
export function updatetakeLeaver(data) {
	return request({
		'url': '/robot/roomconfig/takeLeaverupdate',
		headers: {
			isToken: false
		},
		method: 'put',
		data: data
	})
}


/**
 * 更新进群

 * @param {Object} data
 */
export function updateeventConfig(data) {
	return request({
		'url': '/robot/roomconfig/eventConfigrupdate',
		headers: {
			isToken: false
		},
		method: 'put',
		data: data
	})
}


/**
 * 删除禁排

 * @param {Object} data
 */
export function deletebalockedRecordId(id) {

	const data = {
		id
	}

	return request({
		'url': '/robot/roomconfig/balockedRecordId',
		headers: {
			isToken: false
		},
		method: 'delete',
		params: data
	})
}



// 注册方法
export function register(data) {
	return request({
		url: '/register',
		headers: {
			isToken: false
		},
		method: 'post',
		data: data
	})
}

// 获取用户详细信息
export function getInfo() {
	return request({
		'url': '/getInfo',
		'method': 'get'
	})
}

// 退出方法
export function logout() {
	return request({
		'url': '/logout',
		'method': 'post'
	})
}

// 获取验证码
export function getCodeImg() {
	return request({
		'url': '/captchaImage',
		headers: {
			isToken: false
		},
		method: 'get',
		timeout: 20000
	})
}